package cn.likole.oj.bean;

import org.nutz.dao.entity.annotation.*;

import java.util.Date;

/**
 * Created by likole on 7/26/18.
 * 运行
 */
@Table("solution")
@TableIndexes({@Index(fields = "problemId", unique = false),
        @Index(fields = "userId", unique = false),
        @Index(fields = "contestId", unique = false)})
public class Solution {

    /**
     * 运行编号
     */
    @Id
    private int solutionId;

    /**
     * 问题编号
     */
    @Column
    private int problemId;

    /**
     * 用户编号
     */
    @Column
    private int userId;

    /**
     * 运行时间
     */
    @Column
    private int time;

    /**
     * 运行内存
     */
    @Column
    private int memory;

    /**
     * 提交时间
     */
    @Column
    private Date inDate;

    /**
     * 运行结果
     */
    @Column
    @ColDefine(type = ColType.INT, width = 6)
    private int result;

    /**
     * 所用语言
     */
    @Column
    private int language;

    /**
     * 提交ip
     */
    @Column
    private String ip;

    /**
     * 代码长度
     */
    @Column
    private int codeLength;

    /**
     * 评测时间
     */
    @Column
    private Date judgeTime;

    /**
     * 判题机
     */
    @Column
    private String judger;

    //以下为contest部分
    @Column
    private int contestId;

    @Column
    private int contestNum;

    //映射
    @One(field = "solutionId")
    private SourceCode sourceCode;

    @One(field = "solutionId")
    private CompileInfo compileInfo;

    @One(field = "solutionId")
    private RuntimeInfo runtimeInfo;

    public int getSolutionId() {
        return solutionId;
    }

    public void setSolutionId(int solutionId) {
        this.solutionId = solutionId;
    }

    public int getProblemId() {
        return problemId;
    }

    public void setProblemId(int problemId) {
        this.problemId = problemId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public int getMemory() {
        return memory;
    }

    public void setMemory(int memory) {
        this.memory = memory;
    }

    public Date getInDate() {
        return inDate;
    }

    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }

    public int getLanguage() {
        return language;
    }

    public void setLanguage(int language) {
        this.language = language;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getCodeLength() {
        return codeLength;
    }

    public void setCodeLength(int codeLength) {
        this.codeLength = codeLength;
    }

    public Date getJudgeTime() {
        return judgeTime;
    }

    public void setJudgeTime(Date judgeTime) {
        this.judgeTime = judgeTime;
    }

    public String getJudger() {
        return judger;
    }

    public void setJudger(String judger) {
        this.judger = judger;
    }

    public int getContestId() {
        return contestId;
    }

    public void setContestId(int contestId) {
        this.contestId = contestId;
    }

    public int getContestNum() {
        return contestNum;
    }

    public void setContestNum(int contestNum) {
        this.contestNum = contestNum;
    }

    public SourceCode getSourceCode() {
        return sourceCode;
    }

    public void setSourceCode(SourceCode sourceCode) {
        this.sourceCode = sourceCode;
    }

    public CompileInfo getCompileInfo() {
        return compileInfo;
    }

    public void setCompileInfo(CompileInfo compileInfo) {
        this.compileInfo = compileInfo;
    }

    public RuntimeInfo getRuntimeInfo() {
        return runtimeInfo;
    }

    public void setRuntimeInfo(RuntimeInfo runtimeInfo) {
        this.runtimeInfo = runtimeInfo;
    }

    public String toString1() {
        return problemId + "\n"
               + userId + "\n"
               + language + "\n";
    }
}
